#ifndef _KNN_H_
#define _KNN_H_
#include "define.h"

class CKNN
{
public:
	CKNN(int neighborNum,int classNum,int textNum,BOOL metric);
	CKNN();
	~CKNN(void);
	std::vector<int> Classify(const CString& trainfilename,const CString& testfilename,const CString& cache_folder);
	std::vector<int>  cache_classify(const CString& cache_folder);
	std::vector<int> direct_classify(const CString& trainfilename,const CString& testfilename,const CString& cache_folder);
	//void generateTrainDoc(const CString& filename);
	void setNeighborNum(int neighborNum);
	void setClassNum(int classNum);
	void setMetricType(BOOL metric);
private:
	featRateMap getDocVector(CString& s);
	double computeSim(featRateMap& test,featRateMap& train);
	void generateDoc(const CString& filename,std::vector<docInfo>& docs);
	int getCategory(const simClsMap& sCMap);
private:
	std::vector<docInfo> m_trainDocs;
	int  m_neighborNum;
	BOOL m_metric;
	int  m_classNum;
	int  m_textNum;
	
	
};
#endif